import socket
from threading import  Thread
class Client(object):
    def __init__(self,server_ip="192.168.13.21",server_port=9999):
        self.server_ip=server_ip
        self.server_port=server_port
        self.s=socket.socket()
        self.s.connect((self.server_ip,self.server_port))
    def send(self):
        while True:
            send_meg=input("")
            self.s.send(send_meg.encode())

    def rev(self):
        while True:
            rev_meg=self.s.recv(1024)
            print(f"{rev_meg.decode()}")
    def start(self):
        Thread(target=self.send).start()
        Thread(target=self.rev).start()

    def __del__(self):

        self.s.close()
if __name__ == '__main__':
    c1=Client()
    c1.start()
